package com.nengchuan.eic.nceconomy.config;


import com.nengchuan.eic.nceconomy.filter.AjaxCorsFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    /**
     * 跨域处理过滤器
     * @return
     */
    @Bean
    public FilterRegistrationBean ajaxCorsFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new AjaxCorsFilter());
        registration.addUrlPatterns("/*");
        registration.setOrder(0);
        return registration;
    }
}
